import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/home.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: HomeView,
      meta: {
        title: '首页'
      },
      to: { name: 'home' },
      children: [
        {
          path: 'video-list',
          name: 'video-list',
          component: () => import('../views/videoList.vue'),
          children: [
            {
              path: ':id',
              name: 'video-detail',
              component: () => import('../views/videoDetail.vue'),
              meta: {
                title: '视频详情'
              }
            }
          ],
          meta: {
            title: '视频列表'
          },
          to: { name: 'video-list' }
        },
        {
          path: 'product-presentation',
          name: 'product-presentation',
          component: () => import('../views/productPresentation.vue'),
          meta: {
            title: '建设历程页面'
          },
          to: { name: 'product-presentation' }
        }
      ]
    },
  ],
})

export default router
